/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package behaviourdiagram.impl;

import behaviourdiagram.Actuator;
import behaviourdiagram.Behaviour;
import behaviourdiagram.BehaviourdiagramPackage;
import behaviourdiagram.Mission;
import behaviourdiagram.Sensor;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Mission</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link behaviourdiagram.impl.MissionImpl#getSensor <em>Sensor</em>}</li>
 *   <li>{@link behaviourdiagram.impl.MissionImpl#getBehaviours <em>Behaviours</em>}</li>
 *   <li>{@link behaviourdiagram.impl.MissionImpl#getActuator <em>Actuator</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class MissionImpl extends EObjectImpl implements Mission {
	/**
   * The cached value of the '{@link #getSensor() <em>Sensor</em>}' containment reference list.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #getSensor()
   * @generated
   * @ordered
   */
	protected EList<Sensor> sensor;

	/**
   * The cached value of the '{@link #getBehaviours() <em>Behaviours</em>}' containment reference list.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #getBehaviours()
   * @generated
   * @ordered
   */
	protected EList<Behaviour> behaviours;

	/**
   * The cached value of the '{@link #getActuator() <em>Actuator</em>}' containment reference list.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #getActuator()
   * @generated
   * @ordered
   */
	protected EList<Actuator> actuator;

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	protected MissionImpl() {
    super();
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	protected EClass eStaticClass() {
    return BehaviourdiagramPackage.Literals.MISSION;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public EList<Sensor> getSensor() {
    if (sensor == null)
    {
      sensor = new EObjectContainmentEList<Sensor>(Sensor.class, this, BehaviourdiagramPackage.MISSION__SENSOR);
    }
    return sensor;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public EList<Behaviour> getBehaviours() {
    if (behaviours == null)
    {
      behaviours = new EObjectContainmentEList<Behaviour>(Behaviour.class, this, BehaviourdiagramPackage.MISSION__BEHAVIOURS);
    }
    return behaviours;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public EList<Actuator> getActuator() {
    if (actuator == null)
    {
      actuator = new EObjectContainmentEList<Actuator>(Actuator.class, this, BehaviourdiagramPackage.MISSION__ACTUATOR);
    }
    return actuator;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
    switch (featureID)
    {
      case BehaviourdiagramPackage.MISSION__SENSOR:
        return ((InternalEList<?>)getSensor()).basicRemove(otherEnd, msgs);
      case BehaviourdiagramPackage.MISSION__BEHAVIOURS:
        return ((InternalEList<?>)getBehaviours()).basicRemove(otherEnd, msgs);
      case BehaviourdiagramPackage.MISSION__ACTUATOR:
        return ((InternalEList<?>)getActuator()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
    switch (featureID)
    {
      case BehaviourdiagramPackage.MISSION__SENSOR:
        return getSensor();
      case BehaviourdiagramPackage.MISSION__BEHAVIOURS:
        return getBehaviours();
      case BehaviourdiagramPackage.MISSION__ACTUATOR:
        return getActuator();
    }
    return super.eGet(featureID, resolve, coreType);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
    switch (featureID)
    {
      case BehaviourdiagramPackage.MISSION__SENSOR:
        getSensor().clear();
        getSensor().addAll((Collection<? extends Sensor>)newValue);
        return;
      case BehaviourdiagramPackage.MISSION__BEHAVIOURS:
        getBehaviours().clear();
        getBehaviours().addAll((Collection<? extends Behaviour>)newValue);
        return;
      case BehaviourdiagramPackage.MISSION__ACTUATOR:
        getActuator().clear();
        getActuator().addAll((Collection<? extends Actuator>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public void eUnset(int featureID) {
    switch (featureID)
    {
      case BehaviourdiagramPackage.MISSION__SENSOR:
        getSensor().clear();
        return;
      case BehaviourdiagramPackage.MISSION__BEHAVIOURS:
        getBehaviours().clear();
        return;
      case BehaviourdiagramPackage.MISSION__ACTUATOR:
        getActuator().clear();
        return;
    }
    super.eUnset(featureID);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public boolean eIsSet(int featureID) {
    switch (featureID)
    {
      case BehaviourdiagramPackage.MISSION__SENSOR:
        return sensor != null && !sensor.isEmpty();
      case BehaviourdiagramPackage.MISSION__BEHAVIOURS:
        return behaviours != null && !behaviours.isEmpty();
      case BehaviourdiagramPackage.MISSION__ACTUATOR:
        return actuator != null && !actuator.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //MissionImpl
